home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
TUTORIAL
/
1307B.ZIP
/
TEMPCONV.MOD
< prev
next >
Wrap
Text File
|
1989-01-18
|
2KB
|
66 lines
(* Chapter 4 - Program 4 *)
(* This program is a good example of proper formatting, it is *)
(* easy to read and very easy to understand. It should be a *)
(* snap to update a program that is well written like this. You *)
(* should begin to develop good formatting practice early in *)
(* your programming career. *)
MODULE TempConv;
FROM InOut IMPORT WriteString, WriteInt, WriteLn;
VAR Count : INTEGER; (* a variable used for counting *)
Centigrade : INTEGER; (* the temperature in centigrade *)
Fahrenheit : INTEGER; (* the temperature in fahrenheit *)
BEGIN
WriteString("Fahrenheit to Centigrade temperature table");
WriteLn;
WriteLn;
FOR Count := -2 TO 12 DO
Centigrade := 10 * Count;
Fahrenheit := 32 + Centigrade *9 DIV 5;
WriteString(" C =");
WriteInt(Centigrade,5);
WriteString(" F =");
WriteInt(Fahrenheit,5);
IF Centigrade = 0 THEN
WriteString(" Freezing point of water");
END;
IF Centigrade = 100 THEN
WriteString(" Boiling point of water");
END;
WriteLn;
END; (* of main loop *)
END TempConv.
(* Result of execution
Fahrenheit to Centigrade temperature table
C = -20 F = -4
C = -10 F = 14
C = 0 F = 32 Freezing point of water
C = 10 F = 50
C = 20 F = 68
C = 30 F = 86
C = 40 F = 104
C = 50 F = 122
C = 60 F = 140
C = 70 F = 158
C = 80 F = 176
C = 90 F = 194
C = 100 F = 212 Boiling point of water
C = 110 F = 230
C = 120 F = 248
*)